;(function(){
	var fn = new Function;
	var Ajax = function(config,callback){
		config = config || {};
		var url = config.url;
		if(!url){
			console && console.log("involed url");
			return false;
		}
		var type = config.type || "get";
		var dataType = config.dataType || "json";
		var data = config.data || {};
		var ttimeout = config.ttimeout || 15 * 1000;
		var loading = config.loading || fn;
		var removeLoading = config.removeLoading || fn;
		var timeout = config.timeout || fn;
		var serverError = config.serverError || fn;
		var callback = typeof callback == "function" ? callback : fn;
		$.ajax({
			url : url,
			type : type,
			dataType : dataType,
			timeout : ttimeout,
			data : data,
			beforeSend : function(){ loading()},
			success : function(res){
				removeLoading(res);
				callback(res);
			},
			error : function(xhr,txt){
				removeLoading();
				if(txt == "timeout"){
					timeout();
				}else{
					serverError();
				}
			}
		})
	}

	window["PFT"] = window["PFT"] || {};
	PFT["Ajax"] = Ajax;

})();